package com.lyz.moil.web.service;

import com.lyz.moil.core.orm.hibernate.BaseDao;
import com.lyz.moil.core.orm.hibernate.BaseService;
import com.lyz.moil.web.entity.Device;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class DeviceService extends BaseService<Device> {
    @Override
    @Resource(name = "deviceDao")
    public void setBaseDao(BaseDao<Device> baseDao) {
        this.baseDao = baseDao;
    }


    @Override
    public void save(Device entity) {
        if (entity.isNew()) {
            super.save(entity);
        } else {
            super.update(entity);
        }
    }
}
